package com.project.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import com.project.ds.AreaMapper;
import com.project.entity.area.Area;
import com.project.service.IAreaService;

@Service
public class AreaServiceImpl implements IAreaService{
	
	private static final Logger logger = LoggerFactory.getLogger(AreaServiceImpl.class);
	
	@Autowired
	private AreaMapper areaMapper;

	@Cacheable(value="provinceListCache")
	@Override
	public List<Area> getProvinceList() {
		logger.info("------------获取省级数据--------------");
		return areaMapper.getProvinceList();
	}
	
	@Cacheable(value="childListCache")
	@Override
	public List<Area> getChildList(String code) {
		logger.info("------------根据code,获取子集数据.code:{}--------------",code);
		return areaMapper.getChildList(code);
	}

	@Override
	public String getAreaNameByCode(String code) {
		return areaMapper.getAreaNameByCode(code);
	}


}
